//
// Created by Zeppyrz on 2025/11/6.
//

#ifndef ZEDISK_UPLOADTASK_H
#define ZEDISK_UPLOADTASK_H

#include <fstream>
#include <functional>

#include "CommonTask.h"

namespace ZeDiskGUI {

class UploadTask : public ZeDisk::CommonTask {
 public:
  using UploadCompleteCallback = std::function<void()>;

  void HandleMessage(const ZeDisk::Message *msg) override;
  void WriteCallback() override;
  void ConnectCallback() override;

  bool Stop() override;

  [[nodiscard]] std::string &file_path() { return file_path_; }

  UploadCompleteCallback upload_complete_callback_;

 private:
  std::string file_path_;
  std::ifstream file_;
  int file_size_ = 0;  // 暂时不支持2G大小
};

}  // namespace ZeDiskGUI

#endif  // ZEDISK_UPLOADTASK_H
